package com.springboot;

import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

import java.util.Date;

@SpringBootApplication
public class Springboot02UserIdeaPluginApplication {
    @Bean
    public Date getDate() {
        return new Date();
    }

    public static void main(String[] args) {

        //自动装配
        ConfigurableApplicationContext applicationContext = SpringApplication.run(Springboot02UserIdeaPluginApplication.class, args);
        SqlSessionFactory sqlSessionFactory = applicationContext.getBean(SqlSessionFactory.class);
        Object transcationManager = applicationContext.getBean("transactionManager");
        System.out.println(sqlSessionFactory);
        System.out.println(transcationManager);
//org.apache.ibatis.session.defaults.DefaultSqlSessionFactory@5d7d8613
//org.springframework.jdbc.support.JdbcTransactionManager@6eb089e6
//        applicationContext.close();
    }

}
